package com.itheima01;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class DIeDaiQi2 {
    public static void main(String[] args) {
        Collection<String> c=new ArrayList<>();
        c.add("2");
        c.add("3");
        c.add("4");
        c.add("5");
        c.add("2");
        Iterator<String> iter = c.iterator();
        while (iter.hasNext()) {
            String next = iter.next();
            if(next.equals("2")){ iter.remove();}

        }
        System.out.println("c = " + c);
    }
}
